//
//  CustomView2.m
//  22作业
//
//  Created by dllo on 16/8/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CustomView2.h"
#define width self.bounds.size.width
#define height self.bounds.size.height
@implementation CustomView2

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _collection = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 60, width, 40) collectionViewLayout:_flow];
        _collection.delegate = self;
        _collection.dataSource = self;
        [self addSubview:_collection];
        
        _flow.itemSize = CGSizeMake(30, 30);
        _flow.minimumInteritemSpacing = 10;
        _scrollView = [[UIScrollView alloc] init];
        [_collection registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell1"];
        
    }
    return self;
}

- (void)layoutSubviews
{
    _scrollView.contentSize = CGSizeMake(width * 5, 0);
    _scrollView.frame = CGRectMake(0, 0, width, 60);
    for (int i = 0; i < 5; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
        
        [_scrollView addSubview:imageView];
    }
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell1" forIndexPath:indexPath];
    return cell;
}



@end
